﻿package com.iparticle {
	
	import flash.geom.Point;
	
	public class ParticleMath {
		
		public static function pointFromAngle ( $angle : Number , $distance : Number ) : Point {
			return new Point(Math.cos($angle)*$distance, Math.sin($angle)*$distance);
		}
		
		public static function angleFromPoints ( $point1 : Point , $point2 : Point ) : Number {
			var w:Number = $point1.x - $point2.x;
			var h:Number = $point1.y - $point2.y;
			var angle:Number = radiansToDegrees(Math.atan2(h,w));
			return angle;
		}
		
		public static function radiansToDegrees ( $radians : Number ) : Number {
			return $radians * 180/Math.PI;
		}
		
		public static function degreesToRadians ( $degrees : Number ) : Number {
			return $degrees * Math.PI/180;

		}
		
	}
	
}